﻿using System;

namespace Program05
{
    class Program
    {
        static void Main(string[] args)
        {
            string sex;//性别
            double height;//身高
            double weight;//体重
            double Standards;//标准体重

            Console.WriteLine("请输入您的性别（男/女）：");
            sex = Console.ReadLine();

            if(sex=="男")
            {
                Console.WriteLine("请输入您的身高(cm)");
                height = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("请输入您的体重(kg)");
                weight = Convert.ToDouble(Console.ReadLine());

                Standards = (Convert.ToDouble(height) - 80) * 0.7;//标准体重
                double a = Convert.ToDouble(Standards * 0.1);//10%
                double b = Convert.ToDouble(Standards * 0.2);//20%

                if (weight < (Standards+ a) & weight > (Standards - a))
                {
                    Console.WriteLine("您的健康状态是：体重正常");
                }
                else if (weight >= (Standards + a) & weight <= (Standards + b))
                {
                    Console.WriteLine("您的健康状态是：体重过重");
                }
                else if (weight <= (Standards + a) & weight > (Standards + b))
                {
                    Console.WriteLine("您的健康状态是：体重过轻");
                }
                else if (weight > (Standards + b))
                {
                    Console.WriteLine("您的健康状态是：肥胖");
                }
                else if (weight < (Standards - b))
                {
                    Console.WriteLine("您的健康状态是：体重不足");
                }
                else
                {
                    Console.WriteLine("请输入正确的身高体重");
                }
                Console.ReadLine();
            }
            else if(sex=="女")
            {
                Console.WriteLine("请输入您的身高(cm)");
                height = Convert.ToDouble(Console.ReadLine());
                Console.WriteLine("请输入您的体重(kg)");
                weight = Convert.ToDouble(Console.ReadLine());

                Standards = (Convert.ToDouble(height) - 70) * 0.6;//标准体重
                double a = Convert.ToDouble(Standards * 0.1);//10%
                double b = Convert.ToDouble(Standards * 0.2);//20%

                if (weight < (Standards + a) & weight > (Standards - a))
                {
                    Console.WriteLine("您的健康状态是：体重正常");
                }
                else if (weight >= (Standards + a) & weight <= (Standards + b))
                {
                    Console.WriteLine("您的健康状态是：体重过重");
                }
                else if (weight <= (Standards + a) & weight > (Standards + b))
                {
                    Console.WriteLine("您的健康状态是：体重过轻");
                }
                else if (weight > (Standards + b))
                {
                    Console.WriteLine("您的健康状态是：肥胖");
                }
                else if (weight < (Standards - b))
                {
                    Console.WriteLine("您的健康状态是：体重不足");
                }
                else
                {
                    Console.WriteLine("请输入正确的身高体重");
                }
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("请输入正确的性别");
            }
        }
    }
}
